﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TinyUtil
{
    public class EnumUtil
    {
        public static List<T> EnumToList<T>()
        {
            var list = new List<T>();
            var names = Enum.GetNames(typeof(T));
            foreach (var item in names)
            {
                list.Add((T)Enum.Parse(typeof(T), item));
            }
            return list;
        }

        public static BindingList<T> EnumToBindingList<T>()
        {
            return new BindingList<T>(EnumToList<T>());
        }
    }
}
